package top.chj.day18.genericity.demo2;

/**
 * @Auther:小陈的Java
 * 自定义泛型类
 */
public class User<A,B> {
    private int id;
    private String name;
    private A a;
    private B b;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public A getA() {
        return a;
    }

    public void setA(A a) {
        this.a = a;
    }

    public B getB() {
        return b;
    }

    public void setB(B b) {
        this.b = b;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", a=" + a +
                ", b=" + b +
                '}';
    }

    public static void main(String[] args) {
        User<Integer,String> user = new User<>();
        user.setId(1);
        user.setName("王五");
        user.setA(1);
        user.setB("haha");
        System.out.println(user.getA());
        System.out.println(user.getB());
    }
}
